package com.woniu.outlet.dao;

import com.woniu.outlet.po.Worker;
import com.woniu.outlet.po.WorkerExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Repository
public interface WorkerMapper {
    long countByExample(WorkerExample example);

    int deleteByExample(WorkerExample example);

    int deleteByPrimaryKey(Long id);

    int insert(Worker record);

    int insertSelective(Worker record);

    List<Worker> selectByExample(WorkerExample example);

    Worker selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("record") Worker record, @Param("example") WorkerExample example);

    int updateByExample(@Param("record") Worker record, @Param("example") WorkerExample example);

    int updateByPrimaryKeySelective(Worker record);

    int updateByPrimaryKey(Worker record);

    @Select("select * from erp_system_management.ERP_worker worker where worker.account=#{account}")
    Worker getWorkerByAccount(String account);

    @Select("select p.percode \n" +
            "            from erp_system_management.rbac_perms p\n" +
            "            inner join erp_system_management.rbac_user_perm up on(p.id=up.permid)\n" +
            "            inner join erp_system_management.ERP_worker w on(w.id=up.userid)\n" +
            "            where w.account=#{account}")
    List<String> selectPercodeByPerm(String account);
}